package com.alm.handle.util;

import java.util.List;

public class SendDataSpliceUtil {

    public static byte[] multSpliceData(List<Integer> checkLine, String commandId){
        String[] sumLins = new String[32];
        byte[] date = new byte[6];
        date[0] = 0x03;
        StringBuffer data = new StringBuffer();
        for (int i = 1; i <= sumLins.length; i++) {
            if (!checkLine.contains(i)) {
                data.append("0");
            } else {
                data.append("1");
            }
            if (data.length() % 8 == 0) {
                date[5 - ((i + 1) / 8)] = (byte) Integer.parseInt(data.reverse().toString(), 2);
                data = new StringBuffer();
            }
        }
        switch (Integer.parseInt(commandId)) {
            case 19:
                date[5] = 0x01;
                break;
            case 20:
                date[5] = 0x00;
                break;
        }
        return date;
    }

}
